import { Component, OnInit, ViewChild } from '@angular/core';
import { _HttpClient, ModalHelper } from '@delon/theme';
import { STColumn, STComponent } from '@delon/abc';
import { SFSchema } from '@delon/form';
import { NzMessageService } from 'ng-zorro-antd';
import { ArchiveRevertEditComponent } from './edit/edit.component';
import { ArchiveBorrowViewComponent } from '../borrow/view/view.component';

@Component({
  selector: 'app-archive-revert',
  templateUrl: './revert.component.html',
})
export class ArchiveRevertComponent implements OnInit {
  url = `/archive/dt`;
  params: any = { status: '借出' };
  searchSchema: SFSchema = {
    properties: {
      title: {
        type: 'string',
        title: '公文',
        ui: {
          placeholder: '编号/文号/文件标题',
        },
      },
    }
  };
  @ViewChild('st') st: STComponent;
  columns: STColumn[] = [
    { title: '编号', index: 'no' },
    { title: '文号', index: 'code' },
    { title: '文件标题', index: 'title' },
    { title: '来文单位', index: 'orange' },
    { title: '密级', index: 'dese' },
    // { title: '状态', index: 'status' },
    { title: '借出人', index: 'lender' },
    { title: '借出时间', type: 'date', index: 'lenderAt' },
    { title: '收文时间', index: 'receipt' },
    // { title: '创建时间', type: 'date', index: 'createAt' },
    {
      title: '操作',
      fixed: 'right',
      width: '210px',
      buttons: [
        { text: '归还', icon: 'edit', type: 'modal', modal: { component: ArchiveRevertEditComponent }, click: 'reload' },
        { text: '记录', type: 'modal', modal: { component: ArchiveBorrowViewComponent }, click: 'reload' },
      ]
    }
  ];

  constructor(private http: _HttpClient, private modal: ModalHelper, private message: NzMessageService) { }


  ngOnInit() { }

  add() {
    // this.modal
    //   .createStatic(FormEditComponent, { i: { id: 0 } })
    //   .subscribe(() => this.st.reload());
  }

}
